<script setup>
import { ref } from "vue";
import { agreeListApi } from "@/services/user";
import { onLoad, onShow, onReachBottom } from "@dcloudio/uni-app";

onLoad(() => {
  getList();
});

const agreeList = ref([]);
const getList = async () => {
  try {
    // 发送请求
    let res = await agreeListApi();
    agreeList.value = res.data;
  } catch (e) {
    uni.showToast({
      title: e.info,
      icon: "none",
    });
  }
};

const goagreeDetail = (code) => {
  uni.navigateTo({
    url: "/pages/mine/userAgreementDeatils?code=" + code,
  });
};
</script>
<template>
  <view class="userAgreement">
    <view class="userAgreement-top">
      <!-- <view class="top-text"
        >这是一段关于用户协议的介绍说明。这是一段关于用户协议的介绍说明。这是一段关于用户协议的介绍说明。这是一段关于用户协议的介绍说明。这是一段关于用户协议的介绍说明。这是一段关于用户协议的介绍说明。这是一段关于用户协议的介绍说明。这是一段关于用户协议的介绍说明。</view
      > -->
      <view class="userAgreement-title">通用协议</view>
      <view class="list" v-show="agreeList && agreeList.length > 0">
        <view
          class="list-box"
          v-for="(item, index) in agreeList"
          :key="index"
          @click="goagreeDetail(item.code)"
        >
          <view class="list-box-left">{{ item.name }}</view>
          <view class="list-box-right">
            <image
              src="@/static/my/icon-right-green.png"
              mode="widthFix"
            ></image>
          </view>
        </view>
      </view>
      <view class="nodate-bt" v-if="agreeList.length === 0">
        <image src="/static/nodate/nodate.png" mode="widthFix"></image>
      </view>
    </view>
    <!-- <view class="userAgreement-middle">
      <view class="userAgreement-title">通用协议</view>
      <view class="list">
        <view class="list-item">
          <view class="list-item-title"
            ><view class="cirtle"></view>购买店主套餐</view
          >
          <view class="list-box">
            <view class="list-box-left">如何签署合同/协议的说明</view>
            <view class="list-box-right">
              <image src="@/static/my/icon-right-yellow.png" mode="widthFix"></image>
            </view>
          </view>
        </view>
        <view class="list-item">
          <view class="list-item-title"
            ><view class="cirtle"></view>购买店主套餐</view
          >
          <view class="list-box">
            <view class="list-box-left">如何签署合同/协议的说明</view>
            <view class="list-box-right">
              <image src="@/static/my/icon-right-yellow.png" mode="widthFix"></image>
            </view>
          </view>
        </view>
      </view>
    </view>

    <view class="userAgreement-footer">
      <view class="footer-banner-box">
        <view class="banner-title">您的供货方：</view>
        <view class="banner-content">如购买其他经销套餐，注意供货商变化</view>
        <u-line length="85%" class="notuse-line"></u-line>
      </view>
      <view class="banner-card">
        <view class="banner-card-box">
          <view class="card-img"
            ><image src="@/static/my/icon-user1.png" mode="widthFix"></image
          ></view>
          <view class="card-title">我的供应商：</view>
          <view class="card-name">蓝小平</view>
          <view class="card-link"
            ><u-link
              href="https://uviewui.com/"
              text="说明"
              :under-line="true"
              color="#8C8C8C" line-color="#8C8C8C"
            ></u-link
          ></view>
        </view>
        <view class="banner-card-box">
          <view class="card-img"
            ><image src="@/static/my/icon-phone.png" mode="widthFix"></image
          ></view>
          <view class="card-title">供货商手机：</view>
          <view class="card-name">1245657585</view>
          <view class="card-link"
            ><u-link
              href="https://uviewui.com/"
              text="拨打"
              :under-line="true"
              color="#8C8C8C" line-color="#8C8C8C"
            ></u-link
          ></view>
        </view>
      </view>
    </view> -->
  </view>
</template>
<style lang="scss" scoped>
@import "userAgreement.scss";
</style>
